package shuixian.jing.discuz.activity.base;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;

public class BaseActivity extends Activity {

	// 显示时间
	protected static final int SHOW_TIME = 1;
	private LayoutInflater mLayoutInflater;
	private SharedPreferences mPreferences;
	private Display mDisplay ;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		mLayoutInflater = LayoutInflater.from(this);
		mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
		mDisplay = getWindowManager().getDefaultDisplay();
		//getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,   WindowManager.LayoutParams.FLAG_FULLSCREEN); 
		requestWindowFeature(Window.FEATURE_NO_TITLE);
	}

	/**
	 * 显示一个Toast信息
	 * 
	 * @param p_Msg
	 *            要显示的信息ID
	 */
	protected void showToast(int pResId) {
		Toast.makeText(this, pResId, SHOW_TIME).show();
	}

	/**
	 * 显示一个Toast信息
	 * 
	 * @param p_Msg
	 *            要显示的信息ID
	 */
	protected void showToast(String pMsg) {
		Toast.makeText(this, pMsg, SHOW_TIME).show();
	}
	
	protected void showLog(String pMsg) {
		Log.i("BaseActivity", pMsg);
	}
	/**
	 * 得到LayoutInflater
	 */
	public LayoutInflater getLayoutInflater() {
		return mLayoutInflater;
	}
	/**
	 * 得到配置
	 * @return
	 */
	public SharedPreferences getSharedPreferences() {
		return mPreferences;
	}
	/**
	 * 得到显示信息
	 * @return
	 */
	public Display getDisplay() {
		return mDisplay;
	}
	
}
